package com.mit.web.view.component.monitor
{
	import com.mit.web.config.Constants;
	
	import flash.display.DisplayObject;
	
	import mx.resources.ResourceManager;
	
	public class MonitorToken implements IMonitorToken
	{
		private const DEFAULT_LABEL:String = ResourceManager.getInstance()
			.getString(Constants.BUNDLE_COMMON,'label.wait');
		private var _owner:IProgressMonitor;
		private var _target:Object;
		private var _parent:DisplayObject;
		private var _cancelHandler:Function;
		private var _label:String;
		private var _minValue:Number;
		private var _curValue:Number;
		private var _maxValue:Number;
		
 
		public function MonitorToken(owner:IProgressMonitor, target:Object, parent:DisplayObject, cancelhandler:Function = null)
		{
			_owner = owner;
			_target = target;
			_parent = parent;
			_cancelHandler= cancelhandler;
			_label = DEFAULT_LABEL;
		}
		
		public function get target():Object
		{
			return _target;
		}
		
		public function get parent():DisplayObject
		{
			return _parent;
		}
		
		public function get cancelHander():Function
		{
			return _cancelHandler;
		}
		
		public function get label():String
		{
			return _label;
		}
		
		public function set label(val:String):void
		{
			_label = val;
		}
		
		public function get minValue():Number
		{
			return _minValue;
		}
		
		public function set minValue(val:Number):void
		{
			_minValue = val;
		}
		
		public function get curValue():Number
		{
			return _curValue;
		}
		
		public function set curValue(val:Number):void
		{
			_curValue = val;
		}
		
		public function get maxValue():Number
		{
			return _maxValue;
		}
		
		public function set maxValue(val:Number):void
		{
			_maxValue = val;
		}
		
		public function update(curValue:Number=-1, label:String=null):void
		{
			_owner.update(this, curValue, label);
		}
		
		public function stop():void
		{
			_owner.stop(this);
		}
	}
}